Repository navigation
test(libkernel): pick a foreign process group guest_kill cannot own - #7739
Open
ionut27001 wants to merge 1 commit into
Open
ionut27001 wants to merge 1 commit into
ionut27001 wants to merge 1 commit into
Conversation
guest_kill requires killpg(1000, ...) to fail with ESRCH, but getpid returns the host process id. When Windows gives the test process id 1000, group 1000 is the caller's own, killpg succeeds as the test itself requires for killpg(self, 0), and Require aborts with 0xc0000409. Use self + 1000, which is never the caller's group.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
Contributor
Author
|
On the overlap report: #6044 only renames |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
guest_killfails now and then on the Windows job withExit code 0xc0000409(anabort()) and no message, for example job 117639443072: the first attempt of a build that only held #6218 (AGC storage images), which passed on the rerun.The test checks that
killpgon a process group other than its own fails withESRCH, usingself + 1and the fixed number1000.getpidreturns the host process id (GetCurrentProcessId,::getpid). Windows hands out process ids as multiples of 4 and reuses them, so the test process can get id 1000. Group 1000 is then the caller's own:kill(-1000, 0)succeeds, as the test itself requires a few lines earlier forkillpg(self, 0), andKillpgFails(1000, 0, 3)aborts. With the process id forced to 1000 and the values printed beforeRequire, the run stopped at:The test now uses
self + 1000, which is never the caller's group.killandkillpgare not changed. Test-only.Tested
AMD Ryzen 7 5800X3D (8 cores, 16 threads), Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7 (UCRT), Release,
main676d42396(the test file andSignals.cppare the same on currentmain72a3d9f2a).Process id 1000 cannot be obtained on this machine: a System thread holds client id 1000 (process and thread ids come from one table), and 100,000 suspended
cmd.exestarts never got it. So each run started the test suspended, setClientId.UniqueProcessin its main thread's TEB (the fieldGetCurrentProcessIdreads) and resumed it.maingetpid()= 1000, 200 runsgetpid()= 4, 996, 999, 1001, 1004, 2000, 4000 and 65532, 20 runs eachThe failing runs exit with
0xc0000409, as on CI. In the Build runs from 15 to 19 October (215 failed Windows jobs out of roughly 1,200 Windows test jobs),guest_killfailed once, the job above. It did not fail on Linux in those runs; Linux hands out process ids in increasing order, so 1000 comes back only after the counter wraps.Revert check: with
killpgchanged to succeed for any group when the signal is 0, the test fails 10 of 10 runs, with or without this change.On
72a3d9f2a,ctest -R ^guest_kill$passes 3 of 3 andpython tools/check_conventions.pypasses.Not checked: Linux and macOS, though the change is platform-independent test code.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)